home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2006 April / DPPRO0406DVD.ISO / Essentials / Programming / Eclipse SDK / eclipse-SDK-3.1.1-win32.exe / eclipse / plugins / org.apache.ant_1.6.5 / bin / antenv.cmd < prev    next >
Encoding:
Text File  |  2005-09-29  |  3.1 KB  |  100 lines

  1. /* 
  2.     Copyright 2003-2004 The Apache Software Foundation
  3.   
  4.     Licensed under the Apache License, Version 2.0 (the "License");
  5.     you may not use this file except in compliance with the License.
  6.     You may obtain a copy of the License at
  7.   
  8.         http://www.apache.org/licenses/LICENSE-2.0
  9.   
  10.     Unless required by applicable law or agreed to in writing, software
  11.     distributed under the License is distributed on an "AS IS" BASIS,
  12.     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.     See the License for the specific language governing permissions and
  14.     limitations under the License.
  15.  
  16.     Ant environment
  17. */
  18.  
  19. '@echo off'
  20. call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  21. call SysLoadFuncs
  22.  
  23. /* Prepare the parameters for later use */
  24. parse arg argv
  25. mode = ''
  26. args = ''
  27. opts = ''
  28. cp = ''
  29. lcp = ''
  30.  
  31. do i = 1 to words(argv)
  32.   param = word(argv, i)
  33.   select
  34.     when param='-lcp' then mode = 'l'
  35.     when param='-cp' | param='-classpath' then mode = 'c'
  36.     when abbrev('-opts', param, 4) then mode = 'o'
  37.     when abbrev('-args', param, 4) then mode = 'a'
  38.   otherwise
  39.     select
  40.       when mode = 'a' then args = space(args param, 1)
  41.       when mode = 'c' then cp = space(cp param, 1)
  42.       when mode = 'l' then lcp = space(lcp param, 1)
  43.       when mode = 'o' then opts = space(opts param, 1)
  44.     otherwise
  45.       say 'Option' param 'ignored'
  46.     end
  47.   end
  48. end
  49.  
  50. env="OS2ENVIRONMENT"
  51. antconf = _getenv_('antconf' 'antconf.cmd')
  52. runrc = _getenv_('runrc')
  53. interpret 'call "' || runrc || '"' '"' || antconf || '"' 'ETC'
  54. ANT_HOME = value('ANT_HOME',,env)
  55. JAVA_HOME = value('JAVA_HOME',,env)
  56. classpath = value('CLASSPATH',,env)
  57. classes = stream(JAVA_HOME || "\lib\classes.zip", "C", "QUERY EXISTS")
  58. if classes \= '' then classpath = prepend(classpath classes)
  59. classes = stream(JAVA_HOME || "\lib\tools.jar", "C", "QUERY EXISTS")
  60. if classes \= '' then classpath = prepend(classpath classes)
  61.  
  62. classpath = prepend(classpath ANT_HOME || '\lib\ant-launcher.jar')
  63. 'SET CLASSPATH=' || classpath
  64.  
  65. /* Setting classpathes, options and arguments */
  66. envset = _getenv_('envset')
  67. if cp\=''   then interpret 'call "' || envset || '"' '"; CLASSPATH"' '"' || cp || '"'
  68. if lcp\=''  then interpret 'call "' || envset || '"' '"; LOCALCLASSPATH"' '"' || lcp || '"'
  69. if opts\='' then interpret 'call "' || envset || '"' '"-D ANT_OPTS"' '"' || opts || '"'
  70. if args\='' then interpret 'call "' || envset || '"' '"ANT_ARGS"' '"' || args || '"'
  71.  
  72. exit 0
  73.  
  74. addpath: procedure
  75. parse arg path elem
  76. if elem = '' then do
  77.   if path\='' & right(path, 1)\=';' then path = path || ';'
  78.   return path
  79. end
  80. if substr(path, length(path)) = ';' then glue = ''
  81. else glue = ';'
  82. if pos(translate(elem), translate(path)) = 0 then path = path || glue || elem || ';'
  83. return path
  84.  
  85. prepend: procedure
  86. parse arg path elem
  87. if elem = '' then do
  88.   if path\='' & right(path, 1)\=';' then path = path || ';'
  89.   return path
  90. end
  91. if pos(translate(elem), translate(path)) = 0 then path = elem || ';' || path
  92. return path
  93.  
  94. _getenv_: procedure expose env
  95. parse arg envar default
  96. if default = '' then default = envar
  97. var = value(translate(envar),,env)
  98. if var = '' then var = default
  99. return var
  100.